<?php

class PostVariables
{
	protected $hideResults = true;

	public function setHideResults($hideResults)
	{
		$this->hideResults = $hideResults;
	}
	public function getHTML()
	{

		if ($this->hideResults)
		{
			$html = "<!-- \n";
			$keys = array_keys($_POST);
			foreach($keys as $key)
			{
				$value = "";
				if(is_array($_POST[$key]))
				{
					foreach($_POST[$key] as $element)
					$value .= "[".$element."] ";
				}
				else
					$value = $_POST[$key];

				$html .= $key." - ".$value."\n";
			}
			$html .= "-->\n";

		}
		else
		{
			$html = "<table><tr><th>Key</th><th>Value</th></tr>";
			$keys = array_keys($_POST);
			foreach($keys as $key)
			{
				$value = "";
				if(is_array($_POST[$key]))
				{
					foreach($_POST[$key] as $element)
					$value .= "[".$element."] ";
				}
				else
					$value = $_POST[$key];

				$html .= "<tr><td>".$key."</td><td>".$value."</td></tr>";
			}
			$html .= "</table>\n";
		}
		return $html;
	}
}